const { DataTypes } = require("sequelize");
const seq = require("../db/sequelize");

const Goods = seq.define(
  "goods",
  {
    goods_name: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: "商品名称",
    },
    goods_price: {
      type: DataTypes.DECIMAL(10, 2),
      allowNull: false,
      comment: "商品单价",
    },
    goods_img: {
      type: DataTypes.STRING,
      allowNull: false,
      comment: "商品图片url",
    },
    deal_count: {
      type: DataTypes.STRING,
      defaultValue: "0",
      comment: "销量",
    }
  },
  {
    // 禁用自动生成的 id 列
    id: false, // 禁用默认的 id 列
    paranoid: true,
  }
);

// Goods.sync({ force: true })
module.exports = Goods;